package com.wzcl.app.dao.model;

import com.wzcl.app.dao.model.common.Base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@Data
@Entity
@Table(name = "refund_request")
@ApiModel(value = "退款请求表")
@EntityListeners(AuditingEntityListener.class)
public class RefundRequest implements Base {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @ApiModelProperty(value = "订单号")
    private String orderNo;

    @ApiModelProperty(value = "退款原因")
    private String reason;

    @ApiModelProperty(value = "审核状态")
    private Integer auditState;

    @ApiModelProperty(value = "返回消息")
    private String message;

    @CreatedDate
    @ApiModelProperty(value = "退款发起时间")
    private Date createTime;

    @ApiModelProperty(value = "退款单号")
    @Column(name = "out_refund_no")
    private String outRefundNo;

    @ApiModelProperty(value = "订单创建时间")
    @Transient
    private Date orderCreateTime;

    @ApiModelProperty(value = "用户手机号")
    @Transient
    private String userPhone;

    @Override
    public String toString() {
        return "RefundRequest{" +
                "id=" + id +
                ", orderNo='" + orderNo + '\'' +
                ", reason='" + reason + '\'' +
                ", auditState=" + auditState +
                ", message='" + message + '\'' +
                ", createTime=" + createTime +
                ", outRefundNo='" + outRefundNo + '\'' +
                ", orderCreateTime=" + orderCreateTime +
                ", userPhone='" + userPhone + '\'' +
                '}';
    }
}
